package com.iversonx.scene_1.v2;

import com.iversonx.scene_1.entity.Matter;
import com.iversonx.scene_1.entity.ceiling.LevelOneCeiling;
import com.iversonx.scene_1.entity.ceiling.LevelTwoCeiling;
import com.iversonx.scene_1.entity.coat.DuluxCoat;
import com.iversonx.scene_1.entity.coat.LiBangCoat;
import com.iversonx.scene_1.entity.floor.ShengXiangFloor;
import com.iversonx.scene_1.entity.tile.DongPengTile;
import com.iversonx.scene_1.entity.tile.MarcoPoloTile;
import com.iversonx.scene_1.v2.decoration.DecorationPackage;
import com.iversonx.scene_1.v2.decoration.builder.AbstractDecorationPackageBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 *
 **/
@Component
public class DecorationPackageControllerV2 {
    @Autowired
    private List<AbstractDecorationPackageBuilder> decorationPackageBuilders;
    public String getMatterList(BigDecimal area, Integer level) {
        AbstractDecorationPackageBuilder builder = getDecorationPackageBuilder(level);
        DecorationPackage decorationPackage = builder.build(area);
        return decorationPackage.toString();
    }
    
    private AbstractDecorationPackageBuilder getDecorationPackageBuilder(Integer level) {
        for(AbstractDecorationPackageBuilder builder : decorationPackageBuilders) {
            if(builder.support(level)) {
                return builder;
            }
        }
        throw new UnsupportedOperationException();
    }
}
